class Leechdom < ActiveRecord::Base
  acts_as_taggable
  
  belongs_to :category
  belongs_to :factory
  has_many :comments
  
  #validates_presence_of :generic_name,  :proprietary_name, :factory_id,  :indications, :standard,  :batch_no
  validates_presence_of :generic_name, :proprietary_name, :indications, :standard, :batch_no
  validates_uniqueness_of :batch_no
  validates_numericality_of :price
  
  protected
  def validate
    errors.add(:price,  "should be at least 0.01") if price.nil? || price < 0.01
  end
end
